package com.neutech.demo.day03;

import java.util.Arrays;
import java.util.Random;
import java.util.Scanner;

public class DemoHomeWork01 {

    public static void main(String[] args) {
        Random random = new Random();
        Scanner input = new Scanner(System.in);
        System.out.println("开始随机多少人玩游戏");
//            int random1 = random.nextInt(7);
//            int person = random1 + 12;
        int person = input.nextInt();
            if (person == 12) {
                //进入12人游戏
                person12();
            } else if (person == 13) {
                //进入13人游戏
                persion13();
            } else if (person == 14) {
                //进入14人游戏
                persion14();
            } else if (person == 15) {
                // 进入15人游戏
                persion15();
            } else if (person == 16) {
                //进入16人游戏
                persion16();
            } else if (person == 17) {
                //进入17人游戏
                persion17();
            } else if (person == 18) {
                //进入18人游戏
                persion18();
            } else {
                System.out.println("输入有误，无此类型游戏");
            }
    }
    //排序方法
    public static void personSort18(){
        Scanner input = new Scanner(System.in);
        Random random = new Random();
        String[] person18 = {"狼人","狼人","狼人","狼人","狼人","村民1","村民2","村民3","村民4","村民5","村民6","村民7","预言家","女巫",
                "丘比特","守护者","猎人","村长","替罪羊","吹笛者"};
        //洗牌操作
        for (int i = 0; i <200 ; i++) {
            // TODO 14要变成方法的数字+2
            int index = random.nextInt(20);
            String temp = person18[index];
            person18[index] = person18[0];
            person18[0] = temp;
        }
        //输出除了盗贼牌的数量
        System.out.println(person18.length);
        //输出洗完牌的数组
        System.out.print(Arrays.toString(person18));
        //声明一个三张牌的目标数组
        String[] person18_3 = new String[3];
        System.out.println();
        //把后三张底牌拿出来
        System.arraycopy(person18,person18.length-3,person18_3,0,person18_3.length);
        //判断底牌是否有狼人，如果没有则可以，如果有只能有一个狼人否则重新进行排序
        //遍历底牌进行判断
        int a = 0;//定义变量a，原来a = 0，当进行重复排序的话a = 1
        int b = 0;//当变成狼人的时候进行改变
        for (int i = 0; i <person18_3.length ; i++) {
            if (
                    (person18_3[0] == "狼人" && person18_3[1] == "狼人" )
                            || (person18_3[1] == "狼人"  && person18_3[2] == "狼人")
                            || (person18_3[2] == "狼人" && person18_3[0] == "狼人")
                            || (person18_3[0] == "狼人" && person18_3[2] == "狼人" && person18_3[1] == "狼人")

            ){
                System.out.println("底牌有多狼人，进行重新排序");
                a = 1;
                personSort18();
                break;
            }else {
                break;
            }
        }

        //先输出三张底牌看一下
        if (a == 0){
            System.out.println(Arrays.toString(person18_3) + "正常未调用方法");
            //有盗贼的数组
            String[] person18_d = new String[person18.length+1];
            person18_d = Arrays.copyOf(person18,person18.length-3);
            person18_d = Arrays.copyOf(person18_d,person18_d.length+1);
            for (int i = 0; i <person18_d.length ; i++) {
                person18_d[person18_d.length-1] = "盗贼";
            }
            //加了盗贼之后的数组是12人
            //加了盗贼之后的洗牌
            for (int i = 0; i <180 ; i++) {
                // TODO 下面的数字是方法名的数字
                int index = random.nextInt(18);
                String temp = person18_d[index];
                person18_d[index] = person18_d[0];
                person18_d[0] = temp;
            }
            //加了盗贼之后的洗牌输出
            System.out.println(Arrays.toString(person18_d));
            //让盗贼选择底牌中的人，如果有狼人一定选狼人，如果没有则盗贼自己选
            for (int i = 0; i <person18_3.length ; i++) {
                if (person18_3[0] == "狼人" || person18_3[1] == "狼人" || person18_3[2] == "狼人"){
                    for (int j = 0; j <person18_d.length ; j++) {
                        if (person18_d[j] == "盗贼"){
                            person18_d[j] = "狼人";
                        }
                    }
                    b = 1;
                }else {
                    break;
                }
            }
            //输出底牌分别是什么
            if (b == 0){
                System.out.println("请盗贼选择身份");
                for (int i = 0; i <person18_3.length ; i++) {
                    System.out.println("1、" + person18_3[0] + " 2、" + person18_3[1] + " 3、" + person18_3[2]);
                }
                int select = input.nextInt();
                //替换盗贼为底牌
                //如果玩家选1则把三张底牌的第1张赋值给盗贼，以此类推
                if (select == 1){
                    for (int i = 0; i <person18_d.length ; i++) {
                        if (person18_d[i] == "盗贼"){
                            for (int j = 0; j <person18_3.length ; j++) {
                                person18_d[i] = person18_3[0];
                            }
                        }
                    }
                }else if (select == 2){
                    for (int i = 0; i <person18_d.length ; i++) {
                        if (person18_d[i] == "盗贼"){
                            for (int j = 0; j <person18_3.length ; j++) {
                                person18_d[i] = person18_3[1];
                            }
                        }
                    }
                }else if (select == 3){
                    for (int i = 0; i <person18_d.length ; i++) {
                        if (person18_d[i] == "盗贼"){
                            for (int j = 0; j <person18_3.length ; j++) {
                                person18_d[i] = person18_3[2];
                            }
                        }
                    }
                }
                System.out.println("最终的排序");
                System.out.println(Arrays.toString(person18_d));
            }
            if (b == 1){
                System.out.println("最终的排序");
                System.out.println(Arrays.toString(person18_d));
            }

        }
    }
    public static void personSort17(){
        Scanner input = new Scanner(System.in);
        Random random = new Random();
        String[] person17 = {"狼人","狼人","狼人","狼人","狼人","村民1","村民2","村民3","村民4","村民5","村民6","村民7","预言家","女巫",
                "丘比特","守护者","猎人","村长","替罪羊"};
        //洗牌操作
        for (int i = 0; i <19 ; i++) {
            // TODO 14要变成方法的数字+2
            int index = random.nextInt(19);
            String temp = person17[index];
            person17[index] = person17[0];
            person17[0] = temp;
        }
        //输出除了盗贼牌的数量
        System.out.println(person17.length);
        //输出洗完牌的数组
        System.out.print(Arrays.toString(person17));
        //声明一个三张牌的目标数组
        String[] person17_3 = new String[3];
        System.out.println();
        //把后三张底牌拿出来
        System.arraycopy(person17,person17.length-3,person17_3,0,person17_3.length);
        //判断底牌是否有狼人，如果没有则可以，如果有只能有一个狼人否则重新进行排序
        //遍历底牌进行判断
        int a = 0;//定义变量a，原来a = 0，当进行重复排序的话a = 1
        int b = 0;//当变成狼人的时候进行改变
        for (int i = 0; i <person17_3.length ; i++) {
            if (
                    (person17_3[0] == "狼人" && person17_3[1] == "狼人" )
                            || (person17_3[1] == "狼人"  && person17_3[2] == "狼人")
                            || (person17_3[2] == "狼人" && person17_3[0] == "狼人")
                            || (person17_3[0] == "狼人" && person17_3[2] == "狼人" && person17_3[1] == "狼人")

            ){
                System.out.println("底牌有多狼人，进行重新排序");
                a = 1;
                personSort17();
                break;
            }else {
                break;
            }
        }

        //先输出三张底牌看一下
        if (a == 0){
            System.out.println(Arrays.toString(person17_3) + "正常未调用方法");
            //有盗贼的数组
            String[] person17_d = new String[person17.length+1];
            person17_d = Arrays.copyOf(person17,person17.length-3);
            person17_d = Arrays.copyOf(person17_d,person17_d.length+1);
            for (int i = 0; i <person17_d.length ; i++) {
                person17_d[person17_d.length-1] = "盗贼";
            }
            //加了盗贼之后的数组是12人
            //加了盗贼之后的洗牌
            for (int i = 0; i <170 ; i++) {
                // TODO 下面的数字是方法名的数字
                int index = random.nextInt(17);
                String temp = person17_d[index];
                person17_d[index] = person17_d[0];
                person17_d[0] = temp;
            }
            //加了盗贼之后的洗牌输出
            System.out.println(Arrays.toString(person17_d));
            //让盗贼选择底牌中的人，如果有狼人一定选狼人，如果没有则盗贼自己选
            for (int i = 0; i <person17_3.length ; i++) {
                if (person17_3[0] == "狼人" || person17_3[1] == "狼人" || person17_3[2] == "狼人"){
                    for (int j = 0; j <person17_d.length ; j++) {
                        if (person17_d[j] == "盗贼"){
                            person17_d[j] = "狼人";
                        }
                    }
                    b = 1;
                }else {
                    break;
                }
            }
            //输出底牌分别是什么
            if (b == 0){
                System.out.println("请盗贼选择身份");
                for (int i = 0; i <person17_3.length ; i++) {
                    System.out.println("1、" + person17_3[0] + " 2、" + person17_3[1] + " 3、" + person17_3[2]);
                }
                int select = input.nextInt();
                //替换盗贼为底牌
                //如果玩家选1则把三张底牌的第1张赋值给盗贼，以此类推
                if (select == 1){
                    for (int i = 0; i <person17_d.length ; i++) {
                        if (person17_d[i] == "盗贼"){
                            for (int j = 0; j <person17_3.length ; j++) {
                                person17_d[i] = person17_3[0];
                            }
                        }
                    }
                }else if (select == 2){
                    for (int i = 0; i <person17_d.length ; i++) {
                        if (person17_d[i] == "盗贼"){
                            for (int j = 0; j <person17_3.length ; j++) {
                                person17_d[i] = person17_3[1];
                            }
                        }
                    }
                }else if (select == 3){
                    for (int i = 0; i <person17_d.length ; i++) {
                        if (person17_d[i] == "盗贼"){
                            for (int j = 0; j <person17_3.length ; j++) {
                                person17_d[i] = person17_3[2];
                            }
                        }
                    }
                }
                System.out.println("最终的排序");
                System.out.println(Arrays.toString(person17_d));
            }
            if (b == 1){
                System.out.println("最终的排序");
                System.out.println(Arrays.toString(person17_d));
            }

        }
    }
    public static void personSort16(){
        Scanner input = new Scanner(System.in);
        Random random = new Random();
        String[] person16 = {"狼人","狼人","狼人","狼人","狼人","村民1","村民2","村民3","村民4","村民5","村民6","预言家","女巫",
                "丘比特","守护者","猎人","村长","替罪羊"};
        //洗牌操作
        for (int i = 0; i <160 ; i++) {
            // TODO 14要变成方法的数字+2
            int index = random.nextInt(16);
            String temp = person16[index];
            person16[index] = person16[0];
            person16[0] = temp;
        }
        //输出除了盗贼牌的数量
        System.out.println(person16.length);
        //输出洗完牌的数组
        System.out.print(Arrays.toString(person16));
        //声明一个三张牌的目标数组
        String[] person16_3 = new String[3];
        System.out.println();
        //把后三张底牌拿出来
        System.arraycopy(person16,person16.length-3,person16_3,0,person16_3.length);
        //判断底牌是否有狼人，如果没有则可以，如果有只能有一个狼人否则重新进行排序
        //遍历底牌进行判断
        int a = 0;//定义变量a，原来a = 0，当进行重复排序的话a = 1
        int b = 0;//当变成狼人的时候进行改变
        for (int i = 0; i <person16_3.length ; i++) {
            if (
                    (person16_3[0] == "狼人" && person16_3[1] == "狼人" )
                            || (person16_3[1] == "狼人"  && person16_3[2] == "狼人")
                            || (person16_3[2] == "狼人" && person16_3[0] == "狼人")
                            || (person16_3[0] == "狼人" && person16_3[2] == "狼人" && person16_3[1] == "狼人")

            ){
                System.out.println("底牌有多狼人，进行重新排序");
                a = 1;
                personSort16();
                break;
            }else {
                break;
            }
        }

        //先输出三张底牌看一下
        if (a == 0){
            System.out.println(Arrays.toString(person16_3) + "正常未调用方法");
            //有盗贼的数
            String[] person16_d = new String[person16.length+1];
            person16_d = Arrays.copyOf(person16,person16.length-3);
            person16_d = Arrays.copyOf(person16_d,person16_d.length+1);
            for (int i = 0; i <person16_d.length ; i++) {
                person16_d[person16_d.length-1] = "盗贼";
            }
            //加了盗贼之后的数组是12人
            //加了盗贼之后的洗牌
            for (int i = 0; i <160 ; i++) {
                // TODO 下面的数字是方法名的数字
                int index = random.nextInt(16);
                String temp = person16_d[index];
                person16_d[index] = person16_d[0];
                person16_d[0] = temp;
            }
            //加了盗贼之后的洗牌输出
            System.out.println(Arrays.toString(person16_d));
            //让盗贼选择底牌中的人，如果有狼人一定选狼人，如果没有则盗贼自己选
            for (int i = 0; i <person16_3.length ; i++) {
                if (person16_3[0] == "狼人" || person16_3[1] == "狼人" || person16_3[2] == "狼人"){
                    for (int j = 0; j <person16_d.length ; j++) {
                        if (person16_d[j] == "盗贼"){
                            person16_d[j] = "狼人";
                        }
                    }
                    b = 1;
                }else {
                    break;
                }
            }
            //输出底牌分别是什么
            if (b == 0){
                System.out.println("请盗贼选择身份");
                for (int i = 0; i <person16_3.length ; i++) {
                    System.out.println("1、" + person16_3[0] + " 2、" + person16_3[1] + " 3、" + person16_3[2]);
                }
                int select = input.nextInt();
                //替换盗贼为底牌
                //如果玩家选1则把三张底牌的第1张赋值给盗贼，以此类推
                if (select == 1){
                    for (int i = 0; i <person16_d.length ; i++) {
                        if (person16_d[i] == "盗贼"){
                            for (int j = 0; j <person16_3.length ; j++) {
                                person16_d[i] = person16_3[0];
                            }
                        }
                    }
                }else if (select == 2){
                    for (int i = 0; i <person16_d.length ; i++) {
                        if (person16_d[i] == "盗贼"){
                            for (int j = 0; j <person16_3.length ; j++) {
                                person16_d[i] = person16_3[1];
                            }
                        }
                    }
                }else if (select == 3){
                    for (int i = 0; i <person16_d.length ; i++) {
                        if (person16_d[i] == "盗贼"){
                            for (int j = 0; j <person16_3.length ; j++) {
                                person16_d[i] = person16_3[2];
                            }
                        }
                    }
                }
                System.out.println("最终的排序");
                System.out.println(Arrays.toString(person16_d));
            }
            if (b == 1){
                System.out.println("最终的排序");
                System.out.println(Arrays.toString(person16_d));
            }

        }
    }
    public static void personSort15(){
        Scanner input = new Scanner(System.in);
        Random random = new Random();
        String[] person15 = {"狼人","狼人","狼人","狼人","狼人","村民1","村民2","村民3","村民4","村民5","预言家","女巫",
                "丘比特","守护者","猎人","村长","替罪羊"};
        //洗牌操作
        for (int i = 0; i <170 ; i++) {
            // TODO 14要变成方法的数字+2
            int index = random.nextInt(17);
            String temp = person15[index];
            person15[index] = person15[0];
            person15[0] = temp;
        }
        //输出除了盗贼牌的数量
        System.out.println(person15.length);
        //输出洗完牌的数组
        System.out.print(Arrays.toString(person15));
        //声明一个三张牌的目标数组
        String[] person15_3 = new String[3];
        System.out.println();
        //把后三张底牌拿出来
        System.arraycopy(person15,person15.length-3,person15_3,0,person15_3.length);
        //判断底牌是否有狼人，如果没有则可以，如果有只能有一个狼人否则重新进行排序
        //遍历底牌进行判断
        int a = 0;//定义变量a，原来a = 0，当进行重复排序的话a = 1
        int b = 0;//当变成狼人的时候进行改变
        for (int i = 0; i <person15_3.length ; i++) {
            if (
                    (person15_3[0] == "狼人" && person15_3[1] == "狼人" )
                            || (person15_3[1] == "狼人"  && person15_3[2] == "狼人")
                            || (person15_3[2] == "狼人" && person15_3[0] == "狼人")
                            || (person15_3[0] == "狼人" && person15_3[2] == "狼人" && person15_3[1] == "狼人")

            ){
                System.out.println("底牌有多狼人，进行重新排序");
                a = 1;
                personSort15();
                break;
            }else {
                break;
            }
        }

        //先输出三张底牌看一下
        if (a == 0){
            System.out.println(Arrays.toString(person15_3) + "正常未调用方法");
            //有盗贼的数组
            String[] person15_d = new String[person15.length+1];
            person15_d = Arrays.copyOf(person15,person15.length-3);
            person15_d = Arrays.copyOf(person15_d,person15_d.length+1);
            for (int i = 0; i <person15_d.length ; i++) {
                person15_d[person15_d.length-1] = "盗贼";
            }
            //加了盗贼之后的数组是12人
            //加了盗贼之后的洗牌
            for (int i = 0; i <150 ; i++) {
                // TODO 下面的数字是方法名的数字
                int index = random.nextInt(15);
                String temp = person15_d[index];
                person15_d[index] = person15_d[0];
                person15_d[0] = temp;
            }
            //加了盗贼之后的洗牌输出
            System.out.println(Arrays.toString(person15_d));
            //让盗贼选择底牌中的人，如果有狼人一定选狼人，如果没有则盗贼自己选
            for (int i = 0; i <person15_3.length ; i++) {
                if (person15_3[0] == "狼人" || person15_3[1] == "狼人" || person15_3[2] == "狼人"){
                    for (int j = 0; j <person15_d.length ; j++) {
                        if (person15_d[j] == "盗贼"){
                            person15_d[j] = "狼人";
                        }
                    }
                    b = 1;
                }else {
                    break;
                }
            }
            //输出底牌分别是什么
            if (b == 0){
                System.out.println("请盗贼选择身份");
                for (int i = 0; i <person15_3.length ; i++) {
                    System.out.println("1、" + person15_3[0] + " 2、" + person15_3[1] + " 3、" + person15_3[2]);
                }
                int select = input.nextInt();
                //替换盗贼为底牌
                //如果玩家选1则把三张底牌的第1张赋值给盗贼，以此类推
                if (select == 1){
                    for (int i = 0; i <person15_d.length ; i++) {
                        if (person15_d[i] == "盗贼"){
                            for (int j = 0; j <person15_3.length ; j++) {
                                person15_d[i] = person15_3[0];
                            }
                        }
                    }
                }else if (select == 2){
                    for (int i = 0; i <person15_d.length ; i++) {
                        if (person15_d[i] == "盗贼"){
                            for (int j = 0; j <person15_3.length ; j++) {
                                person15_d[i] = person15_3[1];
                            }
                        }
                    }
                }else if (select == 3){
                    for (int i = 0; i <person15_d.length ; i++) {
                        if (person15_d[i] == "盗贼"){
                            for (int j = 0; j <person15_3.length ; j++) {
                                person15_d[i] = person15_3[2];
                            }
                        }
                    }
                }
                System.out.println("最终的排序");
                System.out.println(Arrays.toString(person15_d));
            }
            if (b == 1){
                System.out.println("最终的排序");
                System.out.println(Arrays.toString(person15_d));
            }

        }
    }
    public static void personSort14(){
        Scanner input = new Scanner(System.in);
        Random random = new Random();
        String[] person14 = {"狼人","狼人","狼人","狼人","村民1","村民2","村民3","村民4","村民5","预言家","女巫",
                "丘比特","守护者","猎人","村长","替罪羊"};
        //洗牌操作
        for (int i = 0; i <140 ; i++) {
            // TODO 14要变成方法的数字+2
            int index = random.nextInt(16);
            String temp = person14[index];
            person14[index] = person14[0];
            person14[0] = temp;
        }
        //输出除了盗贼牌的数量
        System.out.println(person14.length);
        //输出洗完牌的数组
        System.out.print(Arrays.toString(person14));
        //声明一个三张牌的目标数组
        String[] person14_3 = new String[3];
        System.out.println();
        //把后三张底牌拿出来
        System.arraycopy(person14,person14.length-3,person14_3,0,person14_3.length);
        //判断底牌是否有狼人，如果没有则可以，如果有只能有一个狼人否则重新进行排序
        //遍历底牌进行判断
        int a = 0;//定义变量a，原来a = 0，当进行重复排序的话a = 1
        int b = 0;//当变成狼人的时候进行改变
        for (int i = 0; i <person14_3.length ; i++) {
            if (
                    (person14_3[0] == "狼人" && person14_3[1] == "狼人" )
                            || (person14_3[1] == "狼人"  && person14_3[2] == "狼人")
                            || (person14_3[2] == "狼人" && person14_3[0] == "狼人")
                            || (person14_3[0] == "狼人" && person14_3[2] == "狼人" && person14_3[1] == "狼人")

            ){
                System.out.println("底牌有多狼人，进行重新排序");
                a = 1;
                personSort14();
                break;
            }else {
                break;
            }
        }

        //先输出三张底牌看一下
        if (a == 0){
            System.out.println(Arrays.toString(person14_3) + "正常未调用方法");
            //有盗贼的数组
            String[] person14_d = new String[person14.length+1];
            person14_d = Arrays.copyOf(person14,person14.length-3);
            person14_d = Arrays.copyOf(person14_d,person14_d.length+1);
            for (int i = 0; i <person14_d.length ; i++) {
                person14_d[person14_d.length-1] = "盗贼";
            }
            //加了盗贼之后的数组是12人
            //加了盗贼之后的洗牌
            for (int i = 0; i <140 ; i++) {
                // TODO 下面的数字是方法名的数字
                int index = random.nextInt(14);
                String temp = person14_d[index];
                person14_d[index] = person14_d[0];
                person14_d[0] = temp;
            }
            //加了盗贼之后的洗牌输出
            System.out.println(Arrays.toString(person14_d));
            //让盗贼选择底牌中的人，如果有狼人一定选狼人，如果没有则盗贼自己选
            for (int i = 0; i <person14_3.length ; i++) {
                if (person14_3[0] == "狼人" || person14_3[1] == "狼人" || person14_3[2] == "狼人"){
                    for (int j = 0; j <person14_d.length ; j++) {
                        if (person14_d[j] == "盗贼"){
                            person14_d[j] = "狼人";
                        }
                    }
                    b = 1;
                }else {
                    break;
                }
            }
            //输出底牌分别是什么
            if (b == 0){
                System.out.println("请盗贼选择身份");
                for (int i = 0; i <person14_3.length ; i++) {
                    System.out.println("1、" + person14_3[0] + " 2、" + person14_3[1] + " 3、" + person14_3[2]);
                }
                int select = input.nextInt();
                //替换盗贼为底牌
                //如果玩家选1则把三张底牌的第1张赋值给盗贼，以此类推
                if (select == 1){
                    for (int i = 0; i <person14_d.length ; i++) {
                        if (person14_d[i] == "盗贼"){
                            for (int j = 0; j <person14_3.length ; j++) {
                                person14_d[i] = person14_3[0];
                            }
                        }
                    }
                }else if (select == 2){
                    for (int i = 0; i <person14_d.length ; i++) {
                        if (person14_d[i] == "盗贼"){
                            for (int j = 0; j <person14_3.length ; j++) {
                                person14_d[i] = person14_3[1];
                            }
                        }
                    }
                }else if (select == 3){
                    for (int i = 0; i <person14_d.length ; i++) {
                        if (person14_d[i] == "盗贼"){
                            for (int j = 0; j <person14_3.length ; j++) {
                                person14_d[i] = person14_3[2];
                            }
                        }
                    }
                }
                System.out.println("最终的排序");
                System.out.println(Arrays.toString(person14_d));
            }
            if (b == 1){
                System.out.println("最终的排序");
                System.out.println(Arrays.toString(person14_d));
            }

        }
    }
    public static void personSort13(){
        Random random = new Random();
        Scanner input = new Scanner(System.in);
        String[] person13 = {"狼人","狼人","狼人","狼人","村民1","村民2","村民3","村民4","村民5","预言家","女巫",
                "丘比特","守护者","猎人","村长"};
        //洗牌操作
        for (int i = 0; i <150 ; i++) {
            // TODO 14要变成方法的数字+2
            int index = random.nextInt(15);
            String temp = person13[index];
            person13[index] = person13[0];
            person13[0] = temp;
        }
        //输出除了盗贼牌的数量
        System.out.println(person13.length);
        //输出洗完牌的数组
        System.out.print(Arrays.toString(person13));
        //声明一个三张牌的目标数组
        String[] person13_3 = new String[3];
        System.out.println();
        //把后三张底牌拿出来
        System.arraycopy(person13,person13.length-3,person13_3,0,person13_3.length);
        //判断底牌是否有狼人，如果没有则可以，如果有只能有一个狼人否则重新进行排序
        //遍历底牌进行判断
        int a = 0;//定义变量a，原来a = 0，当进行重复排序的话a = 1
        int b = 0;//当变成狼人的时候进行改变
        for (int i = 0; i <person13_3.length ; i++) {
            if (
                    (person13_3[0] == "狼人" && person13_3[1] == "狼人" )
                            || (person13_3[1] == "狼人"  && person13_3[2] == "狼人")
                            || (person13_3[2] == "狼人" && person13_3[0] == "狼人")
                            || (person13_3[0] == "狼人" && person13_3[2] == "狼人" && person13_3[1] == "狼人")

            ){
                System.out.println("底牌有多狼人，进行重新排序");
                a = 1;
                personSort13();
                break;
            }else {
                break;
            }
        }

        //先输出三张底牌看一下
        if (a == 0){
            System.out.println(Arrays.toString(person13_3) + "正常未调用方法");
            //有盗贼的数组
            String[] person13_d = new String[person13.length+1];
            person13_d = Arrays.copyOf(person13,person13.length-3);
            person13_d = Arrays.copyOf(person13_d,person13_d.length+1);
            for (int i = 0; i <person13_d.length ; i++) {
                person13_d[person13_d.length-1] = "盗贼";
            }
            //加了盗贼之后的数组是13人
            //加了盗贼之后的洗牌
            for (int i = 0; i <130 ; i++) {
                // TODO 下面的数字是方法名的数字
                int index = random.nextInt(13);
                String temp = person13_d[index];
                person13_d[index] = person13_d[0];
                person13_d[0] = temp;
            }
            //加了盗贼之后的洗牌输出
            System.out.println(Arrays.toString(person13_d));
            //让盗贼选择底牌中的人，如果有狼人一定选狼人，如果没有则盗贼自己选
            for (int i = 0; i <person13_3.length ; i++) {
                if (person13_3[0] == "狼人" || person13_3[1] == "狼人" || person13_3[2] == "狼人"){
                    for (int j = 0; j <person13_d.length ; j++) {
                        if (person13_d[j] == "盗贼"){
                            person13_d[j] = "狼人";
                        }
                    }
                    b = 1;
                }else {
                    break;
                }
            }
            //输出底牌分别是什么
            if (b == 0){
                System.out.println("请盗贼选择身份");
                for (int i = 0; i <person13_3.length ; i++) {
                    System.out.println("1、" + person13_3[0] + " 2、" + person13_3[1] + " 3、" + person13_3[2]);
                }
                int select = input.nextInt();
                //替换盗贼为底牌
                //如果玩家选1则把三张底牌的第1张赋值给盗贼，以此类推
                if (select == 1){
                    for (int i = 0; i <person13_d.length ; i++) {
                        if (person13_d[i] == "盗贼"){
                            for (int j = 0; j <person13_3.length ; j++) {
                                person13_d[i] = person13_3[0];
                            }
                        }
                    }
                }else if (select == 2){
                    for (int i = 0; i <person13_d.length ; i++) {
                        if (person13_d[i] == "盗贼"){
                            for (int j = 0; j <person13_3.length ; j++) {
                                person13_d[i] = person13_3[1];
                            }
                        }
                    }
                }else if (select == 3){
                    for (int i = 0; i <person13_d.length ; i++) {
                        if (person13_d[i] == "盗贼"){
                            for (int j = 0; j <person13_3.length ; j++) {
                                person13_d[i] = person13_3[2];
                            }
                        }
                    }
                }
                System.out.println("最终的排序");
                System.out.println(Arrays.toString(person13_d));
            }
            if (b == 1){
                System.out.println("最终的排序");
                System.out.println(Arrays.toString(person13_d));
            }

        }
    }
    // TODO 12人排序方法
    public static void personSort12(){
        //生成随机数
        Random random = new Random();
        Scanner input = new Scanner(System.in);
        String[] person12 = {"狼人","狼人","狼人","狼人","村民1","村民2","村民3","村民4","预言家","女巫",
                "丘比特","守护者","猎人","村长"};
        // TODO 排序方法开始复制的地方
        //洗牌操作
        for (int i = 0; i <140 ; i++) {
            // TODO 14要变成方法的数字+2
            int index = random.nextInt(14);
            String temp = person12[index];
            person12[index] = person12[0];
            person12[0] = temp;
        }
        //输出除了盗贼牌的数量
        System.out.println(person12.length);
        //输出洗完牌的数组
        System.out.print(Arrays.toString(person12));
        //声明一个三张牌的目标数组
        String[] person12_3 = new String[3];
        System.out.println();
        //把后三张底牌拿出来
        System.arraycopy(person12,person12.length-3,person12_3,0,person12_3.length);
        //判断底牌是否有狼人，如果没有则可以，如果有只能有一个狼人否则重新进行排序
        //遍历底牌进行判断
        int a = 0;//定义变量a，原来a = 0，当进行重复排序的话a = 1
        int b = 0;//当变成狼人的时候进行改变
        for (int i = 0; i <person12_3.length ; i++) {
            if (
                    (person12_3[0] == "狼人" && person12_3[1] == "狼人" )
                            || (person12_3[1] == "狼人"  && person12_3[2] == "狼人")
                            || (person12_3[2] == "狼人" && person12_3[0] == "狼人")
                            || (person12_3[0] == "狼人" && person12_3[2] == "狼人" && person12_3[1] == "狼人")

            ){
                System.out.println("底牌有多狼人，进行重新排序");
                a = 1;
                personSort12();
                break;
            }else {
                break;
            }
        }

        //先输出三张底牌看一下
        if (a == 0){
            System.out.println(Arrays.toString(person12_3) + "正常未调用方法");
            //有盗贼的数组
            String[] person12_d = new String[person12.length+1];
            person12_d = Arrays.copyOf(person12,person12.length-3);
            person12_d = Arrays.copyOf(person12_d,person12_d.length+1);
            for (int i = 0; i <person12_d.length ; i++) {
                person12_d[person12_d.length-1] = "盗贼";
            }
            //加了盗贼之后的数组是12人
            //加了盗贼之后的洗牌
            for (int i = 0; i <120 ; i++) {
                // TODO 下面的数字是方法名的数字
                int index = random.nextInt(12);
                String temp = person12_d[index];
                person12_d[index] = person12_d[0];
                person12_d[0] = temp;
            }
            //加了盗贼之后的洗牌输出
            System.out.println(Arrays.toString(person12_d));
            //让盗贼选择底牌中的人，如果有狼人一定选狼人，如果没有则盗贼自己选
            for (int i = 0; i <person12_3.length ; i++) {
                if (person12_3[0] == "狼人" || person12_3[1] == "狼人" || person12_3[2] == "狼人"){
                    for (int j = 0; j <person12_d.length ; j++) {
                        if (person12_d[j] == "盗贼"){
                            person12_d[j] = "狼人";
                        }
                    }
                    b = 1;
                }else {
                    break;
                }
            }
            //输出底牌分别是什么
            if (b == 0){
                System.out.println("请盗贼选择身份");
                for (int i = 0; i <person12_3.length ; i++) {
                    System.out.println("1、" + person12_3[0] + " 2、" + person12_3[1] + " 3、" + person12_3[2]);
                }
                int select = input.nextInt();
                //替换盗贼为底牌
                //如果玩家选1则把三张底牌的第1张赋值给盗贼，以此类推
                if (select == 1){
                    for (int i = 0; i <person12_d.length ; i++) {
                        if (person12_d[i] == "盗贼"){
                            for (int j = 0; j <person12_3.length ; j++) {
                                person12_d[i] = person12_3[0];
                            }
                        }
                    }
                }else if (select == 2){
                    for (int i = 0; i <person12_d.length ; i++) {
                        if (person12_d[i] == "盗贼"){
                            for (int j = 0; j <person12_3.length ; j++) {
                                person12_d[i] = person12_3[1];
                            }
                        }
                    }
                }else if (select == 3){
                    for (int i = 0; i <person12_d.length ; i++) {
                        if (person12_d[i] == "盗贼"){
                            for (int j = 0; j <person12_3.length ; j++) {
                                person12_d[i] = person12_3[2];
                            }
                        }
                    }
                }
                System.out.println("最终的排序");
                System.out.println(Arrays.toString(person12_d));
            }
            if (b == 1){
                System.out.println("最终的排序");
                System.out.println(Arrays.toString(person12_d));
            }

        }
        // TODO 排序方法复制结束的地方

    }
    // TODO 12人玩的方法
       //下面是不同人数的方法
    public static void person12(){
        //一共15张牌，除了盗贼的14张牌
        //输入工具类
        Scanner input = new Scanner(System.in);
        //生成随机数
        Random random = new Random();
        String[] person12 = {"狼人","狼人","狼人","狼人","村民1","村民2","村民3","村民4","预言家","女巫",
                   "丘比特","守护者","猎人","村长"};
        // TODO 人方法开始复制的地方
        //洗牌操作
        for (int i = 0; i <140 ; i++) {
            // TODO 下面的数字是方法名数字+2
            int index = random.nextInt(14);
            String temp = person12[index];
            person12[index] = person12[0];
            person12[0] = temp;
        }
        //输出除了盗贼牌的数量
        System.out.println(person12.length);
        //输出洗完牌的数组
        System.out.print(Arrays.toString(person12));
        //声明一个三张牌的目标数组
        String[] person12_3 = new String[3];
        System.out.println();
        //把后三张底牌拿出来
        System.arraycopy(person12,person12.length-3,person12_3,0,person12_3.length);

        //判断底牌是否有狼人，如果没有则可以，如果有只能有一个狼人否则重新进行排序
        //遍历底牌进行判断
        int a = 0;
        int b = 0;
        for (int i = 0; i <person12_3.length ; i++) {
            if (
                    (person12_3[0] == "狼人" && person12_3[1] == "狼人" )
                            || (person12_3[1] == "狼人"  && person12_3[2] == "狼人")
                            || (person12_3[2] == "狼人" && person12_3[0] == "狼人")
                            || (person12_3[0] == "狼人" && person12_3[2] == "狼人" && person12_3[1] == "狼人")
            ){
                System.out.println(Arrays.toString(person12_3));
                System.out.println("底牌有多狼人，进行重新排序");
                personSort12();
//                System.out.println(Arrays.toString(person12_3) + "正常未调用方法");
                a = 1;
                break;
            }else {
                break;
            }
        }
        //把盗贼加到除了底牌的那些牌在进行洗牌        //输出原来的牌看一下
        //先输出三张底牌看一下
        if (a == 0){
            System.out.println(Arrays.toString(person12_3) + "正常未调用方法");
            //有盗贼的数组
            String[] person12_d = new String[person12.length+1];
            person12_d = Arrays.copyOf(person12,person12.length-3);
            person12_d = Arrays.copyOf(person12_d,person12_d.length+1);
            for (int i = 0; i <person12_d.length ; i++) {
                person12_d[person12_d.length-1] = "盗贼";
            }
            //加了盗贼之后的数组是12人
            //加了盗贼之后的洗牌
            for (int i = 0; i <150 ; i++) {
                int index = random.nextInt(12);
                String temp = person12_d[index];
                person12_d[index] = person12_d[0];
                person12_d[0] = temp;
            }
            //加了盗贼之后的洗牌输出
            System.out.println(Arrays.toString(person12_d));
            //让盗贼选择底牌中的人，如果有狼人一定选狼人，如果没有则盗贼自己选
            for (int i = 0; i <person12_3.length ; i++) {
                if (person12_3[0] == "狼人" || person12_3[1] == "狼人" || person12_3[2] == "狼人"){
                    for (int j = 0; j <person12_d.length ; j++) {
                        if (person12_d[j] == "盗贼"){
                            person12_d[j] = "狼人";
                        }
                    }
                }else {
                    break;
                }
            }
            //输出底牌分别是什么
            if (b == 0){
                System.out.println("请盗贼选择身份");
                for (int i = 0; i <person12_3.length ; i++) {
                    System.out.println("1、" + person12_3[0] + " 2、" + person12_3[1] + " 3、" + person12_3[2]);
                }
                int select = input.nextInt();
                //替换盗贼为底牌
                //如果玩家选1则把三张底牌的第1张赋值给盗贼，以此类推
                if (select == 1){
                    for (int i = 0; i <person12_d.length ; i++) {
                        if (person12_d[i] == "盗贼"){
                            for (int j = 0; j <person12_3.length ; j++) {
                                person12_d[i] = person12_3[0];
                            }
                        }
                    }
                }else if (select == 2){
                    for (int i = 0; i <person12_d.length ; i++) {
                        if (person12_d[i] == "盗贼"){
                            for (int j = 0; j <person12_3.length ; j++) {
                                person12_d[i] = person12_3[1];
                            }
                        }
                    }
                }else if (select == 3){
                    for (int i = 0; i <person12_d.length ; i++) {
                        if (person12_d[i] == "盗贼"){
                            for (int j = 0; j <person12_3.length ; j++) {
                                person12_d[i] = person12_3[2];
                            }
                        }
                    }
                }
                System.out.println("最终的排序");
                System.out.println(Arrays.toString(person12_d));
            }
            if (b == 1){
                System.out.println("最终的排序");
                System.out.println(Arrays.toString(person12_d));
            }


        }
        //TODO 人方法复制结束的地方
    }
    // TODO 13人玩的方法
    public static void persion13(){
        //一共16张牌，除了盗贼的15张牌
        //生成随机数
        Scanner input = new Scanner(System.in);
        Random random = new Random();
        String[] person13 = {"狼人","狼人","狼人","狼人","村民1","村民2","村民3","村民4","村民5","预言家","女巫",
                "丘比特","守护者","猎人","村长"};
        // TODO 人方法开始复制的地方
        //洗牌操作
        for (int i = 0; i <150 ; i++) {
            // TODO 下面的数字是方法名数字+2
            int index = random.nextInt(15);
            String temp = person13[index];
            person13[index] = person13[0];
            person13[0] = temp;
        }
        //输出除了盗贼牌的数量
        System.out.println(person13.length);
        //输出洗完牌的数组
        System.out.print(Arrays.toString(person13));
        //声明一个三张牌的目标数组
        String[] person13_3 = new String[3];
        System.out.println();
        //把后三张底牌拿出来
        System.arraycopy(person13,person13.length-3,person13_3,0,person13_3.length);

        //判断底牌是否有狼人，如果没有则可以，如果有只能有一个狼人否则重新进行排序
        //遍历底牌进行判断
        int a = 0;
        int b = 0;
        for (int i = 0; i <person13_3.length ; i++) {
            if (
                    (person13_3[0] == "狼人" && person13_3[1] == "狼人" )
                            || (person13_3[1] == "狼人"  && person13_3[2] == "狼人")
                            || (person13_3[2] == "狼人" && person13_3[0] == "狼人")
                            || (person13_3[0] == "狼人" && person13_3[2] == "狼人" && person13_3[1] == "狼人")
            ){
                System.out.println(Arrays.toString(person13_3));
                System.out.println("底牌有多狼人，进行重新排序");
                personSort13();
//                System.out.println(Arrays.toString(person12_3) + "正常未调用方法");
                a = 1;
                break;
            }else {
                break;
            }
        }
        //把盗贼加到除了底牌的那些牌在进行洗牌        //输出原来的牌看一下
        //先输出三张底牌看一下
        if (a == 0){
            System.out.println(Arrays.toString(person13_3) + "正常未调用方法");
            //有盗贼的数组
            String[] person13_d = new String[person13.length+1];
            person13_d = Arrays.copyOf(person13,person13.length-3);
            person13_d = Arrays.copyOf(person13_d,person13_d.length+1);
            for (int i = 0; i <person13_d.length ; i++) {
                person13_d[person13_d.length-1] = "盗贼";
            }
            //加了盗贼之后的数组是12人
            //加了盗贼之后的洗牌

            for (int i = 0; i <130 ; i++) {
                int index = random.nextInt(13);
                String temp = person13_d[index];
                person13_d[index] = person13_d[0];
                person13_d[0] = temp;
            }
            //加了盗贼之后的洗牌输出
            System.out.println(Arrays.toString(person13_d));
            //让盗贼选择底牌中的人，如果有狼人一定选狼人，如果没有则盗贼自己选
            for (int i = 0; i <person13_3.length ; i++) {
                if (person13_3[0] == "狼人" || person13_3[1] == "狼人" || person13_3[2] == "狼人"){
                    for (int j = 0; j <person13_d.length ; j++) {
                        if (person13_d[j] == "盗贼"){
                            person13_d[j] = "狼人";
                        }
                    }
                    b = 1;
                }else {
                    break;
                }
            }
            //输出底牌分别是什么
            if (b == 0){
                System.out.println("请盗贼选择身份");
                for (int i = 0; i <person13_3.length ; i++) {
                    System.out.println("1、" + person13_3[0] + " 2、" + person13_3[1] + " 3、" + person13_3[2]);
                }
                int select = input.nextInt();
                //替换盗贼为底牌
                //如果玩家选1则把三张底牌的第1张赋值给盗贼，以此类推
                if (select == 1){
                    for (int i = 0; i <person13_d.length ; i++) {
                        if (person13_d[i] == "盗贼"){
                            for (int j = 0; j <person13_3.length ; j++) {
                                person13_d[i] = person13_3[0];
                            }
                        }
                    }
                }else if (select == 2){
                    for (int i = 0; i <person13_d.length ; i++) {
                        if (person13_d[i] == "盗贼"){
                            for (int j = 0; j <person13_3.length ; j++) {
                                person13_d[i] = person13_3[1];
                            }
                        }
                    }
                }else if (select == 3){
                    for (int i = 0; i <person13_d.length ; i++) {
                        if (person13_d[i] == "盗贼"){
                            for (int j = 0; j <person13_3.length ; j++) {
                                person13_d[i] = person13_3[2];
                            }
                        }
                    }
                }
                System.out.println("最终的排序");
                System.out.println(Arrays.toString(person13_d));
            }
            if (b == 1){
                System.out.println("最终的排序");
                System.out.println(Arrays.toString(person13_d));
            }


        }
        //TODO 人方法复制结束的地方
    }
    // TODO 14人玩的方法
    public static void persion14(){
        //一共17张牌，除了盗贼的16张牌
        //生成随机数
        Scanner input = new Scanner(System.in);
        Random random = new Random();
        String[] person14 = {"狼人","狼人","狼人","狼人","村民1","村民2","村民3","村民4","村民5","预言家","女巫",
                "丘比特","守护者","猎人","村长","替罪羊"};
        for (int i = 0; i <160 ; i++) {
            int index = random.nextInt(16);
            String temp = person14[index];
            person14[index] = person14[0];
            person14[0] = temp;
        }
        //输出除了盗贼牌的数量
        System.out.println(person14.length);
        //输出洗完牌的数组
        System.out.print(Arrays.toString(person14));
        //声明一个三张牌的目标数组
        String[] person14_3 = new String[3];
        System.out.println();
        //把后三张底牌拿出来
        System.arraycopy(person14,person14.length-3,person14_3,0,person14_3.length);

        //判断底牌是否有狼人，如果没有则可以，如果有只能有一个狼人否则重新进行排序
        //遍历底牌进行判断
        int a = 0;
        int b = 0;
        for (int i = 0; i <person14_3.length ; i++) {
            if (
                    (person14_3[0] == "狼人" && person14_3[1] == "狼人" )
                            || (person14_3[1] == "狼人"  && person14_3[2] == "狼人")
                            || (person14_3[2] == "狼人" && person14_3[0] == "狼人")
                            || (person14_3[0] == "狼人" && person14_3[2] == "狼人" && person14_3[1] == "狼人")
            ){
                System.out.println(Arrays.toString(person14_3));
                System.out.println("底牌有多狼人，进行重新排序");
                personSort14();
//                System.out.println(Arrays.toString(person12_3) + "正常未调用方法");
                a = 1;
                break;
            }else {
                break;
            }
        }
        //把盗贼加到除了底牌的那些牌在进行洗牌        //输出原来的牌看一下
        //先输出三张底牌看一下
        if (a == 0){
            System.out.println(Arrays.toString(person14_3) + "正常未调用方法");
            //有盗贼的数组
            String[] person14_d = new String[person14.length+1];
            person14_d = Arrays.copyOf(person14,person14.length-3);
            person14_d = Arrays.copyOf(person14_d,person14_d.length+1);
            for (int i = 0; i <person14_d.length ; i++) {
                person14_d[person14_d.length-1] = "盗贼";
            }
            //加了盗贼之后的数组是12人
            //加了盗贼之后的洗牌

            for (int i = 0; i <140 ; i++) {
                int index = random.nextInt(14);
                String temp = person14_d[index];
                person14_d[index] = person14_d[0];
                person14_d[0] = temp;
            }
            //加了盗贼之后的洗牌输出
            System.out.println(Arrays.toString(person14_d));
            //让盗贼选择底牌中的人，如果有狼人一定选狼人，如果没有则盗贼自己选
            for (int i = 0; i <person14_3.length ; i++) {
                if (person14_3[0] == "狼人" || person14_3[1] == "狼人" || person14_3[2] == "狼人"){
                    for (int j = 0; j <person14_d.length ; j++) {
                        if (person14_d[j] == "盗贼"){
                            person14_d[j] = "狼人";
                        }
                    }
                    b = 1;
                }else {
                    break;
                }
            }
            //输出底牌分别是什么
            if (b == 0){
                System.out.println("请盗贼选择身份");
                for (int i = 0; i <person14_3.length ; i++) {
                    System.out.println("1、" + person14_3[0] + " 2、" + person14_3[1] + " 3、" + person14_3[2]);
                }
                int select = input.nextInt();
                //替换盗贼为底牌
                //如果玩家选1则把三张底牌的第1张赋值给盗贼，以此类推
                if (select == 1){
                    for (int i = 0; i <person14_d.length ; i++) {
                        if (person14_d[i] == "盗贼"){
                            for (int j = 0; j <person14_3.length ; j++) {
                                person14_d[i] = person14_3[0];
                            }
                        }
                    }
                }else if (select == 2){
                    for (int i = 0; i <person14_d.length ; i++) {
                        if (person14_d[i] == "盗贼"){
                            for (int j = 0; j <person14_3.length ; j++) {
                                person14_d[i] = person14_3[1];
                            }
                        }
                    }
                }else if (select == 3){
                    for (int i = 0; i <person14_d.length ; i++) {
                        if (person14_d[i] == "盗贼"){
                            for (int j = 0; j <person14_3.length ; j++) {
                                person14_d[i] = person14_3[2];
                            }
                        }
                    }
                }
                System.out.println("最终的排序");
                System.out.println(Arrays.toString(person14_d));
            }
            if (b == 1){
                System.out.println("最终的排序");
                System.out.println(Arrays.toString(person14_d));
            }
        }
        //TODO 人方法复制结束的地方
    }
    // TODO 15人玩的方法
    public static void persion15(){
        //一共18张牌，除了盗贼的17张牌
        //生成随机数
        Scanner input = new Scanner(System.in);
        Random random = new Random();
        String[] person15 = {"狼人","狼人","狼人","狼人","狼人","村民1","村民2","村民3","村民4","村民5","预言家","女巫",
                "丘比特","守护者","猎人","村长","替罪羊"};
        for (int i = 0; i <170 ; i++) {
            int index = random.nextInt(17);
            String temp = person15[index];
            person15[index] = person15[0];
            person15[0] = temp;
        }
        //输出除了盗贼牌的数量
        System.out.println(person15.length);
        //输出洗完牌的数组
        System.out.print(Arrays.toString(person15));
        //声明一个三张牌的目标数组
        String[] person15_3 = new String[3];
        System.out.println();
        //把后三张底牌拿出来
        System.arraycopy(person15,person15.length-3,person15_3,0,person15_3.length);

        //判断底牌是否有狼人，如果没有则可以，如果有只能有一个狼人否则重新进行排序
        //遍历底牌进行判断
        int a = 0;
        int b = 0;
        for (int i = 0; i <person15_3.length ; i++) {
            if (
                    (person15_3[0] == "狼人" && person15_3[1] == "狼人" )
                            || (person15_3[1] == "狼人"  && person15_3[2] == "狼人")
                            || (person15_3[2] == "狼人" && person15_3[0] == "狼人")
                            || (person15_3[0] == "狼人" && person15_3[2] == "狼人" && person15_3[1] == "狼人")
            ){
                System.out.println(Arrays.toString(person15_3));
                System.out.println("底牌有多狼人，进行重新排序");
                personSort15();
//                System.out.println(Arrays.toString(person12_3) + "正常未调用方法");
                a = 1;
                break;
            }else {
                break;
            }
        }
        //把盗贼加到除了底牌的那些牌在进行洗牌        //输出原来的牌看一下
        //先输出三张底牌看一下
        if (a == 0){
            System.out.println(Arrays.toString(person15_3) + "正常未调用方法");
            //有盗贼的数组
            String[] person15_d = new String[person15.length+1];
            person15_d = Arrays.copyOf(person15,person15.length-3);
            person15_d = Arrays.copyOf(person15_d,person15_d.length+1);
            for (int i = 0; i <person15_d.length ; i++) {
                person15_d[person15_d.length-1] = "盗贼";
            }
            //加了盗贼之后的数组是12人
            //加了盗贼之后的洗牌
            //TODO 这里的数字就是方法名的数字
            for (int i = 0; i <150 ; i++) {
                int index = random.nextInt(15);
                String temp = person15_d[index];
                person15_d[index] = person15_d[0];
                person15_d[0] = temp;
            }
            //加了盗贼之后的洗牌输出
            System.out.println(Arrays.toString(person15_d));

            //让盗贼选择底牌中的人，如果有狼人一定选狼人，如果没有则盗贼自己选
            for (int i = 0; i <person15_3.length;i++) {
                if (person15_3[0] == "狼人" || person15_3[1] == "狼人" || person15_3[2] == "狼人"){
                    for (int j = 0; j <person15_d.length ; j++) {
                        if (person15_d[j] == "盗贼"){
                            person15_d[j] = "狼人";
                        }
                    }
                    b = 1;

                }else {
                    break;
                }
            }
            //输出底牌分别是什么
            if (b == 0){
                System.out.println("请盗贼选择身份");
                for (int i = 0; i <person15_3.length ; i++) {
                    System.out.println("1、" + person15_3[0] + " 2、" + person15_3[1] + " 3、" + person15_3[2]);
                }
                int select = input.nextInt();
                //替换盗贼为底牌
                //如果玩家选1则把三张底牌的第1张赋值给盗贼，以此类推
                if (select == 1){
                    for (int i = 0; i <person15_d.length ; i++) {
                        if (person15_d[i] == "盗贼"){
                            for (int j = 0; j <person15_3.length ; j++) {
                                person15_d[i] = person15_3[0];
                            }
                        }
                    }
                }else if (select == 2){
                    for (int i = 0; i <person15_d.length ; i++) {
                        if (person15_d[i] == "盗贼"){
                            for (int j = 0; j <person15_3.length ; j++) {
                                person15_d[i] = person15_3[1];
                            }
                        }
                    }
                }else if (select == 3){
                    for (int i = 0; i <person15_d.length ; i++) {
                        if (person15_d[i] == "盗贼"){
                            for (int j = 0; j <person15_3.length ; j++) {
                                person15_d[i] = person15_3[2];
                            }
                        }
                    }
                }
                System.out.println("最终的排序");
                System.out.println(Arrays.toString(person15_d));
            }
            if (b == 1){
                System.out.println("最终的排序");
                System.out.println(Arrays.toString(person15_d));
            }


        }
        //TODO 人方法复制结束的地方
    }
    // TODO 16人玩的方法
    public static void persion16(){
        //一共19张牌，除了盗贼的18张牌
        //生成随机数
        Scanner input = new Scanner(System.in);
        Random random = new Random();
        String[] person16 = {"狼人","狼人","狼人","狼人","狼人","村民1","村民2","村民3","村民4","村民5","村民6","预言家","女巫",
                "丘比特","守护者","猎人","村长","替罪羊"};
        for (int i = 0; i <180 ; i++) {
            int index = random.nextInt(18);
            String temp = person16[index];
            person16[index] = person16[0];
            person16[0] = temp;
        }
        //输出除了盗贼牌的数量
        System.out.println(person16.length);
        //输出洗完牌的数组
        System.out.print(Arrays.toString(person16));
        //声明一个三张牌的目标数组
        String[] person16_3 = new String[3];
        System.out.println();
        //把后三张底牌拿出来
        System.arraycopy(person16,person16.length-3,person16_3,0,person16_3.length);

        //判断底牌是否有狼人，如果没有则可以，如果有只能有一个狼人否则重新进行排序
        //遍历底牌进行判断
        int a = 0;
        int b = 0;
        for (int i = 0; i <person16_3.length ; i++) {
            if (
                    (person16_3[0] == "狼人" && person16_3[1] == "狼人" )
                            || (person16_3[1] == "狼人"  && person16_3[2] == "狼人")
                            || (person16_3[2] == "狼人" && person16_3[0] == "狼人")
                            || (person16_3[0] == "狼人" && person16_3[2] == "狼人" && person16_3[1] == "狼人")
            ){
                System.out.println(Arrays.toString(person16_3));
                System.out.println("底牌有多狼人，进行重新排序");
                personSort16();
//                System.out.println(Arrays.toString(person12_3) + "正常未调用方法");
                a = 1;
                break;
            }else {
                break;
            }
        }
        //把盗贼加到除了底牌的那些牌在进行洗牌        //输出原来的牌看一下
        //先输出三张底牌看一下
        if (a == 0){
            System.out.println(Arrays.toString(person16_3) + "正常未调用方法");
            //有盗贼的数组
            String[] person16_d = new String[person16.length+1];
            person16_d = Arrays.copyOf(person16,person16.length-3);
            person16_d = Arrays.copyOf(person16_d,person16_d.length+1);
            for (int i = 0; i <person16_d.length ; i++) {
                person16_d[person16_d.length-1] = "盗贼";
            }
            //加了盗贼之后的数组是12人
            //加了盗贼之后的洗牌
            //TODO 这里的数字就是方法名的数字
            for (int i = 0; i <160 ; i++) {
                int index = random.nextInt(16);
                String temp = person16_d[index];
                person16_d[index] = person16_d[0];
                person16_d[0] = temp;
            }
            //加了盗贼之后的洗牌输出
            System.out.println(Arrays.toString(person16_d));
            //让盗贼选择底牌中的人，如果有狼人一定选狼人，如果没有则盗贼自己选
            for (int i = 0; i <person16_3.length ; i++) {
                if (person16_3[0] == "狼人" || person16_3[1] == "狼人" || person16_3[2] == "狼人"){
                    for (int j = 0; j <person16_d.length ; j++) {
                        if (person16_d[j] == "盗贼"){
                            person16_d[j] = "狼人";
                        }
                    }
                    b = 1;
                }else {
                    break;
                }
            }
            //输出底牌分别是什么
            if (b == 0){
                System.out.println("请盗贼选择身份");
                for (int i = 0; i <person16_3.length ; i++) {
                    System.out.println("1、" + person16_3[0] + " 2、" + person16_3[1] + " 3、" + person16_3[2]);
                }
                int select = input.nextInt();
                //替换盗贼为底牌
                //如果玩家选1则把三张底牌的第1张赋值给盗贼，以此类推
                if (select == 1){
                    for (int i = 0; i <person16_d.length ; i++) {
                        if (person16_d[i] == "盗贼"){
                            for (int j = 0; j <person16_3.length ; j++) {
                                person16_d[i] = person16_3[0];
                            }
                        }
                    }
                }else if (select == 2){
                    for (int i = 0; i <person16_d.length ; i++) {
                        if (person16_d[i] == "盗贼"){
                            for (int j = 0; j <person16_3.length ; j++) {
                                person16_d[i] = person16_3[1];
                            }
                        }
                    }
                }else if (select == 3){
                    for (int i = 0; i <person16_d.length ; i++) {
                        if (person16_d[i] == "盗贼"){
                            for (int j = 0; j <person16_3.length ; j++) {
                                person16_d[i] = person16_3[2];
                            }
                        }
                    }
                }
                System.out.println("最终的排序");
                System.out.println(Arrays.toString(person16_d));
            }
            if (b == 1){
                System.out.println("最终的排序");
                System.out.println(Arrays.toString(person16_d));
            }


        }
        //TODO 人方法复制结束的地方
    }
    // TODO 17人玩的方法
    public static void persion17(){
        //一共20张牌，除了盗贼的19张牌
        //生成随机数
        Scanner input = new Scanner(System.in);
        Random random = new Random();
        String[] person17 = {"狼人","狼人","狼人","狼人","狼人","村民1","村民2","村民3","村民4","村民5","村民6","村民7","预言家","女巫",
                "丘比特","守护者","猎人","村长","替罪羊"};
        for (int i = 0; i <190 ; i++) {
            int index = random.nextInt(19);
            String temp = person17[index];
            person17[index] = person17[0];
            person17[0] = temp;
        }
        //输出除了盗贼牌的数量

        System.out.println(person17.length);
        //输出洗完牌的数组
        System.out.print(Arrays.toString(person17));
        //声明一个三张牌的目标数组
        String[] person17_3 = new String[3];
        System.out.println();
        //把后三张底牌拿出来
        System.arraycopy(person17,person17.length-3,person17_3,0,person17_3.length);

        //判断底牌是否有狼人，如果没有则可以，如果有只能有一个狼人否则重新进行排序
        //遍历底牌进行判断
        int a = 0;
        int b = 0;
        for (int i = 0; i <person17_3.length ; i++) {
            if (
                    (person17_3[0] == "狼人" && person17_3[1] == "狼人" )
                            || (person17_3[1] == "狼人"  && person17_3[2] == "狼人")
                            || (person17_3[2] == "狼人" && person17_3[0] == "狼人")
                            || (person17_3[0] == "狼人" && person17_3[2] == "狼人" && person17_3[1] == "狼人")
            ){
                System.out.println(Arrays.toString(person17_3));
                System.out.println("底牌有多狼人，进行重新排序");
                personSort17();
//                System.out.println(Arrays.toString(person12_3) + "正常未调用方法");
                a = 1;
                break;
            }else {
                break;
            }
        }
        //把盗贼加到除了底牌的那些牌在进行洗牌        //输出原来的牌看一下
        //先输出三张底牌看一下
        if (a == 0){
            System.out.println(Arrays.toString(person17_3) + "正常未调用方法");
            //有盗贼的数组
            String[] person17_d = new String[person17.length+1];
            person17_d = Arrays.copyOf(person17,person17.length-3);
            person17_d = Arrays.copyOf(person17_d,person17_d.length+1);
            for (int i = 0; i <person17_d.length ; i++) {
                person17_d[person17_d.length-1] = "盗贼";
            }
            //加了盗贼之后的数组是12人
            //加了盗贼之后的洗牌
            //TODO 这里的数字就是方法名的数字
            for (int i = 0; i <170 ; i++) {
                int index = random.nextInt(17);
                String temp = person17_d[index];
                person17_d[index] = person17_d[0];
                person17_d[0] = temp;
            }
            //加了盗贼之后的洗牌输出
            System.out.println(Arrays.toString(person17_d));
            //让盗贼选择底牌中的人，如果有狼人一定选狼人，如果没有则盗贼自己选
            for (int i = 0; i <person17_3.length ; i++) {
                if (person17_3[0] == "狼人" || person17_3[1] == "狼人" || person17_3[2] == "狼人"){
                    for (int j = 0; j <person17_d.length ; j++) {
                        if (person17_d[j] == "盗贼"){
                            person17_d[j] = "狼人";
                        }
                    }
                    b = 1;
                }else {
                    break;
                }
            }
            //输出底牌分别是什么
            if (b == 0){
                System.out.println("请盗贼选择身份");
                for (int i = 0; i <person17_3.length ; i++) {
                    System.out.println("1、" + person17_3[0] + " 2、" + person17_3[1] + " 3、" + person17_3[2]);
                }
                int select = input.nextInt();
                //替换盗贼为底牌
                //如果玩家选1则把三张底牌的第1张赋值给盗贼，以此类推
                if (select == 1){
                    for (int i = 0; i <person17_d.length ; i++) {
                        if (person17_d[i] == "盗贼"){
                            for (int j = 0; j <person17_3.length ; j++) {
                                person17_d[i] = person17_3[0];
                            }
                        }
                    }
                }else if (select == 2){
                    for (int i = 0; i <person17_d.length ; i++) {
                        if (person17_d[i] == "盗贼"){
                            for (int j = 0; j <person17_3.length ; j++) {
                                person17_d[i] = person17_3[1];
                            }
                        }
                    }
                }else if (select == 3){
                    for (int i = 0; i <person17_d.length ; i++) {
                        if (person17_d[i] == "盗贼"){
                            for (int j = 0; j <person17_3.length ; j++) {
                                person17_d[i] = person17_3[2];
                            }
                        }
                    }
                }
                System.out.println("最终的排序");
                System.out.println(Arrays.toString(person17_d));
            }
            if (b == 1){
                System.out.println("最终的排序");
                System.out.println(Arrays.toString(person17_d));
            }


        }
        //TODO 人方法复制结束的地方
    }
    // TODO 18人玩的方法
    public static void persion18(){
        //一共21张牌，除了盗贼的20张牌
        //生成随机数
        Scanner input = new Scanner(System.in);
        Random random = new Random();
        String[] person18 = {"狼人","狼人","狼人","狼人","狼人","村民1","村民2","村民3","村民4","村民5","村民6","村民7","预言家","女巫",
                "丘比特","守护者","猎人","村长","替罪羊","吹笛者"};
        for (int i = 0; i <200 ; i++) {
            int index = random.nextInt(20);
            String temp = person18[index];
            person18[index] = person18[0];
            person18[0] = temp;
        }
        //输出除了盗贼牌的数量
        System.out.println(person18.length);
        //输出洗完牌的数组
        System.out.print(Arrays.toString(person18));
        //声明一个三张牌的目标数组
        String[] person18_3 = new String[3];
        System.out.println();
        //把后三张底牌拿出来
        System.arraycopy(person18,person18.length-3,person18_3,0,person18_3.length);

        //判断底牌是否有狼人，如果没有则可以，如果有只能有一个狼人否则重新进行排序
        //遍历底牌进行判断
        int a = 0;
        int b = 0;
        for (int i = 0; i <person18_3.length ; i++) {
            if (
                    (person18_3[0] == "狼人" && person18_3[1] == "狼人" )
                            || (person18_3[1] == "狼人"  && person18_3[2] == "狼人")
                            || (person18_3[2] == "狼人" && person18_3[0] == "狼人")
                            || (person18_3[0] == "狼人" && person18_3[2] == "狼人" && person18_3[1] == "狼人")
            ){
                System.out.println(Arrays.toString(person18_3));
                System.out.println("底牌有多狼人，进行重新排序");
                personSort18();
//                System.out.println(Arrays.toString(person12_3) + "正常未调用方法");
                a = 1;
                break;
            }else {
                break;
            }
        }
        //把盗贼加到除了底牌的那些牌在进行洗牌        //输出原来的牌看一下
        //先输出三张底牌看一下
        if (a == 0){
            System.out.println(Arrays.toString(person18_3) + "正常未调用方法");
            //有盗贼的数组
            String[] person18_d = new String[person18.length+1];
            person18_d = Arrays.copyOf(person18,person18.length-3);
            person18_d = Arrays.copyOf(person18_d,person18_d.length+1);
            for (int i = 0; i <person18_d.length ; i++) {
                person18_d[person18_d.length-1] = "盗贼";
            }
            //加了盗贼之后的数组是12人
            //加了盗贼之后的洗牌
            //TODO 这里的数字就是方法名的数字
            for (int i = 0; i <180 ; i++) {
                int index = random.nextInt(18);
                String temp = person18_d[index];
                person18_d[index] = person18_d[0];
                person18_d[0] = temp;
            }
            //加了盗贼之后的洗牌输出
            System.out.println(Arrays.toString(person18_d));
            //让盗贼选择底牌中的人，如果有狼人一定选狼人，如果没有则盗贼自己选
            for (int i = 0; i <person18_3.length ; i++) {
                if (person18_3[0] == "狼人" || person18_3[1] == "狼人" || person18_3[2] == "狼人"){
                    for (int j = 0; j <person18_d.length ; j++) {
                        if (person18_d[j] == "盗贼"){
                            person18_d[j] = "狼人";
                        }
                    }
                    b = 1;
                }else {
                    break;
                }
            }
            //输出底牌分别是什么
            if (b == 0){
                System.out.println("请盗贼选择身份");
                for (int i = 0; i <person18_3.length ; i++) {
                    System.out.println("1、" + person18_3[0] + " 2、" + person18_3[1] + " 3、" + person18_3[2]);
                }
                int select = input.nextInt();
                //替换盗贼为底牌
                //如果玩家选1则把三张底牌的第1张赋值给盗贼，以此类推
                if (select == 1){
                    for (int i = 0; i <person18_d.length ; i++) {
                        if (person18_d[i] == "盗贼"){
                            for (int j = 0; j <person18_3.length ; j++) {
                                person18_d[i] = person18_3[0];
                            }
                        }
                    }
                }else if (select == 2){
                    for (int i = 0; i <person18_d.length ; i++) {
                        if (person18_d[i] == "盗贼"){
                            for (int j = 0; j <person18_3.length ; j++) {
                                person18_d[i] = person18_3[1];
                            }
                        }
                    }
                }else if (select == 3){
                    for (int i = 0; i <person18_d.length ; i++) {
                        if (person18_d[i] == "盗贼"){
                            for (int j = 0; j <person18_3.length ; j++) {
                                person18_d[i] = person18_3[2];
                            }
                        }
                    }
                }
                System.out.println("最终的排序");
                System.out.println(Arrays.toString(person18_d));
            }
            if (b == 1){
                System.out.println("最终的排序");
                System.out.println(Arrays.toString(person18_d));
            }
        }
        //TODO 人方法复制结束的地方
    }

}
